package com.lyf.service.impl;

import com.lyf.dao.UserDao;
import com.lyf.dao.impl.UserDaoImpl;
import com.lyf.pojo.User;
import com.lyf.service.UserService;
import com.lyf.utils.PageModel;

import java.util.List;

public class UserServiceImpl implements UserService {
    UserDao userDao = new UserDaoImpl();

    @Override
    public User login(String loginname, String password) {
        return userDao.login(loginname,password);
    }

    @Override
    public User findPassword(String loginname, String phone) {
        return userDao.findPassword(loginname,phone);
    }

    @Override
    public int selectAdminCount() {
        return userDao.selectAdminCount();
    }

    @Override
    public int selectUserCount() {
        return userDao.selectUserCount();
    }

    @Override
    public void updatePassword(String password, Integer id) {
        userDao.updatePassword(password,id);
    }

    @Override
    public void register(User user) {
        userDao.register(user);
    }

    @Override
    public void add(User user) {
        userDao.add(user);
    }

    @Override
    public void delete(Integer id) {
        userDao.delete(id);
    }

    @Override
    public void update(User user)  {
        userDao.update(user);
    }

    @Override
    public void updateStatus(Integer id, Integer status) {
        userDao.updateStatus(id,status);
    }

    @Override
    public List<User> selectAll() {
        List<User> users = userDao.selectAll();
        return users;
    }

    @Override
    public User selectById(Integer id) {
        return userDao.selectById(id);
    }

    @Override
    public User selectByloginname(String loginname) {
        return userDao.selectByloginname(loginname);
    }

    @Override
    public List<User> queryUsers(User user, PageModel model) {
        return userDao.queryUsers(user,model);
    }

    @Override
    public int getTotalUserCount(User user) {
        return userDao.getTotalUserCount(user);
    }

    @Override
    public List<User> queryUsers2(User user, PageModel model) {
        return userDao.queryUsers2(user,model);
    }

    @Override
    public int getTotalUserCount2(User user) {
        return userDao.getTotalUserCount2(user);
    }
}
